package com.applet.shop.controller;

import com.applet.entity.Shop;
import com.applet.result.Result;
import com.applet.shop.service.ShopService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 店铺管理 controller
 */
@Slf4j
@RestController
@RequestMapping("/user/shop")
public class ShopController {


    @Resource
    private ShopService shopService;



    /**
     * 店铺管理
     *        查询店铺营业状态
     * @param id                项目默认只有一家店
     * @param shopName          所以参数可选
     */
    @GetMapping("/status")
    public Result getShopStatus(Long id, String shopName){
        log.info("店铺管理 - 查询店铺营业状态，店铺id: {},店铺名称: {}", id, shopName);
        //封装查询数据
        Shop shop = Shop.builder().id(id).shopName(shopName).build();
        Integer shopStatus = shopService.selectShopStatus(shop);
        return Result.success(shopStatus);
    }




}
